******************************** Perceived Conflict and Leader Dominance: *****************************************************
****************** Individual and Contextual Factors Behind Preferences for Dominant Leaders **********************************

*************************************FORTHCOMING IN POLITICAL PSYCHOLOGY*******************************************************

*--------------------------------------------REPLICATION FILES----------------------------------------------------------------*

*                                            RECODES VARIABLES                                                                *

*** Creates country identifier: "1" = Ukraine; "2" = Polen
tab country
label define countryLB 1 "Ukraine" 2 "Poland"
label values country countryLB


*** Creates Variable for geographic context: "0" = Poland, "1" = No-Conflict Ukraine; "2" = Conflict Ukraine
gen geo_context=0
replace geo_context=1 if region==1 & country==1 | region==2 & country==1 | region==5 & country==1
replace geo_context=2 if region==3 & country==1 | region==4 & country==1

*Labels for geographic context
label define geo_contextLB 0 "Poland" 1 "No-Conflict Ukraine" 2 "Conflict Ukraine"
label values geo_context geo_contextLB

tab geo_context


**** BACKGROUND variables and demographics
*** Participant sex; "1" = female; "2" = male
clonevar sex = qa

*** Participant age
clonevar age = qb

*** Participant education
generate education = .
replace education = 1 if qe == 1 & country == 1
replace education = 1 if qe == 1 & country == 2
replace education = 1 if qe == 2 & country == 1
replace education = 1 if qe == 2 & country == 2
replace education = 2 if qe == 3 & country == 1
replace education = 2 if qe == 3 & country == 2
replace education = 3 if qe == 4 & country == 1
replace education = 3 if qe == 4 & country == 2
replace education = 4 if qe == 5 & country == 1
replace education = 4 if qe == 5 & country == 2
replace education = 5 if qe == 6 & country == 1
replace education = 5 if qe == 6 & country == 2

*Labels for education
label define educationLB 1 "Primary school or High school" 2 "Basic Vocational school" 3 "Secondary school" 4 "Bachelor's Degree" 5 "Master degree/Science degree and Doctorate"
label values education educationLB


**** INDIVIDUAL DIFFERENCE MEASURES
*** Social Dominance Orientation (higher value = higher SDO)
* Recodes such that items have same direction
recode q1_3 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
recode q1_4 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
recode q1_7 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
recode q1_8 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
alpha q1_1 q1_2 q1_3 q1_4 q1_5 q1_6 q1_7 q1_8, item

* Creates SDO measure on 0-1 scale
egen sdo = rowmean(q1_1 q1_2 q1_3 q1_4 q1_5 q1_6 q1_7 q1_8)
generate SDO=(sdo-1)/6


*** Rightwing Authoritarianism (higher value = higher RWA)
* Recodes such that items have same direction
recode q2_1 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
recode q2_2 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
recode q2_6 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
recode q2_7 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
alpha q2_1 q2_2 q2_3 q2_4 q2_5 q2_6 q2_7 q2_8, item

* Creates RWA measure on 0-1 scale based on all 8 items
egen rwa = rowmean(q2_1 q2_2 q2_3 q2_4 q2_5 q2_6 q2_7 q2_8)
generate RWA = (rwa-1)/6

* Creates RWA measure without item q2_3 because this improves Cronbach's alpha
alpha q2_1 q2_2 q2_4 q2_5 q2_6 q2_7 q2_8, item

egen rwa_7 = rowmean(q2_1 q2_2 q2_4 q2_5 q2_6 q2_7 q2_8)
generate RWA_7 = (rwa_7-1)/6


*** Political ideology: Left-right self-placement
generate left_right = q8/10
summ left_right


*** Participants' behavior in the Hawk-Dove game
recode q12 (1=0) (2=1), generate(HD_game)
*Labels for Hawk-Dove game
label define HD_gameLB 0 "Dovish strategy" 1 "Hawkish strategy"
label values HD_game HD_gameLB


*** Participants' identification with Ukraine/Poland (depending on country), Russia, and Europe (higher values = stronger identification)
* Ukraine/Poland
alpha q4a_1 q4b_1 q4c_1
egen identUkrainePoland = rowmean(q4a_1 q4b_1 q4c_1)
*Creates variable on 0-1 scale
generate identify_UkrainePoland = (identUkrainePoland-1)/6

* Russia
alpha q4a_2 q4b_2 q4c_2
egen identRussia = rowmean(q4a_2 q4b_2 q4c_2)
*Creates variable on 0-1 scale
generate identify_Russia = (identRussia-1)/6

* Europe
alpha q4a_3 q4b_2 q4c_3
egen identEurope = rowmean(q4a_3 q4b_2 q4c_3)
*Creates variable on 0-1 scale
generate identify_Europe =(identEurope-1)/6


*** Participants' emotional reactions (larger value = stronger emotion)
clonevar enthusiasm = q5_1
clonevar happy = q5_2
clonevar angry = q5_3
clonevar hatred = q5_4
clonevar anxious = q5_5
clonevar fear = q5_6

* Creates three sets of emotions: Fight (angry + hatred), Flight (anxious + fear), and positive emotions (enthusiasm + happy)
pwcorr enthusiasm happy angry hatred anxious fear, sig

* Creates emotions on three separate 0-1 scales
gen fight=(angry+hatred-2)/12
gen flight=(fear+anxious-2)/12
gen posemot= (enthusiasm+happy-2)/12



*--------------------------------------------- Experimental conditions -------------------------------------------------------*
*** Contextual variable
generate context =.
replace context = 2 if q6a == 1
replace context = 2 if q6a == 2
replace context = 3 if q6b == 1
replace context = 3 if q6b == 2
replace context = 1 if q6c == 1
replace context = 1 if q6c == 2

*Labels for contextual condition
label define contextLB 1 "Neutral" 2 "Cooperation/Dam" 3 "Conflict/War"
label values context contextLB


*----------------------------------------- Dependent variable: Face choice ---------------------------------------------------*
*** Choice of face ("0" = non-dominant face; "1" = dominant face)
generate choice =.
replace choice = 1 if q6a == 1
replace choice = 1 if q6b == 1
replace choice = 1 if q6c == 1
replace choice = 0 if q6a == 2
replace choice = 0 if q6b == 2
replace choice = 0 if q6c == 2

*Labels for choice of face
label define choiceLB 0 "Non-dominant" 1 "Dominant" 
label values choice choiceLB


************************************************ ANALYSES **********************************************************************

*---------------------------------TEST 1: EXPERIMENTAL EFFECT OF CONTEXTUAL CONDITIONS-----------------------------------------*

*** Conflict (war) vs. Control (neutral)
ttest choice if context != 2, by(context)

*Conflict (war) vs. No-Conflict (cooperation/dam)
ttest choice if context > 1, by(context)

*No-Conflict (cooperation/dam) vs. Control (neutral)
ttest choice if context < 3, by(context)


*Do the contextual effects differ between Ukraine and Poland? (see note 4)
logit choice i.context##i.country
testparm context#country


*** Graphical illustration of contextual effects (Figure 2)
logit choice i.context
margins context
marginsplot, recastci(rcap) ciopts(lpattern(dash)) recast(bar) yline(0) xlabel(#3) ///
xtitle(context) ytitle(proportion choosing dominant face) title("") scheme(s2color)



*------------------------ TEST 2:INDIVIDUAL DIFFERENCES AND PREFERENCES FOR DOMINANT LEADERS ---------------------------------*

** Descriptives for the used variables
summ SDO RWA left_right HD_game

***** Effects of SDO, RWA and Ideology (reported in Supplementary Materials S.6)
logit choice c.SDO c.RWA c.left_right i.context i.sex c.age i.education i.geo_context 
logit choice c.SDO c.RWA c.left_right i.context i.sex c.age i.education i.geo_context, or

*Do the effects differ between Poland and Ukraine? (see note 8)
logit choice c.SDO##i.country c.RWA c.left_right i.context i.sex c.age i.education i.geo_context 
logit choice c.SDO c.RWA c.left_right##i.country i.context i.sex c.age i.education i.geo_context 
logit choice c.SDO c.RWA##i.country c.left_right i.context i.sex c.age i.education i.geo_context 

**Do the effect of SDO differ across experimental contexts?
logit choice c.SDO##i.context c.RWA c.left_right i.sex c.age i.education i.geo_context
testparm context#c.SDO

*** Graphical illustration of SDO effect (Figure 3)
summ SDO, detail
logit choice c.SDO c.RWA c.left_right i.context i.sex c.age i.education i.geo_context 
margins, at(SDO=(0(0.05)1))
marginsplot, recastci(rline) ciopts(lpattern(dash)) recast(line) yline(0) xlabel(0 (0.1) 1) ylabel(0 (0.2) 0.8) xline(.0416667 .6041667) ///
xtitle(Social Dominance Orientation) ytitle(pred. prob. dominant face) title("") scheme(s2color)


***** Effect of Hawk-Dove game behavior (reported in Supplementary Materials S.6)
logit choice i.HD_game i.context i.sex c.age i.education i.geo_context 
logit choice i.HD_game i.context i.sex c.age i.education i.geo_context, or

*** Graphical illustration of Hawk-Dove game behavior effect (Figure 4)
logit choice i.HD_game i.context i.sex c.age i.education i.geo_context 

margins HD_game,
marginsplot, recastci(rcap) ciopts(lpattern(dash)) recast(bar) yline(0) xlabel(#2) ///
xtitle(Hawk-Dove Game Behavior) ytitle(pred. prob. dominant face) title("") scheme(s2color)



*------------------------- TEST 3: The Crimea Crisis of 2014 and Preferences for Dominant Leaders---------------------------*
*                                            ONLY UKRAINIAN SUBJECT                                                         *
** Descriptives for the used variables
*Correlations between specific emotions
corr angry hatred fear anxious if country == 1

* Descriptives for FIGHT (angry + hatred) and FLIGHT (fear + anxious) related emotions, respectively
summ fight flight if country == 1

* Descriptives for identificatio with Russia and Ukraine
summ identify_Russia identify_UkrainePoland if country == 1


** Main effect of geographic context within Ukraine (Conflict versus No-Conflict region) (Reported in Supplementary Materials S.10)
logit choice i.context i.sex c.age i.education i.geo_context if country==1
logit choice i.context i.sex c.age i.education i.geo_context if country==1, or


** Interactive relationships between FIGHT and FLIGHT emotions and geographic context within Ukraine (Reported in Supplementary Materials S.10)
logit choice c.flight##i.geo_context c.fight##i.geo_context i.context i.sex c.age i.education if country==1
logit choice c.flight##i.geo_context c.fight##i.geo_context i.context i.sex c.age i.education if country==1, or

testparm geo_context#c.flight
testparm geo_context#c.fight

* Regression coefficients for FIGHT and FLIGHT in Conflict region (changing reference category for geographic context variable)
logit choice c.flight##ib(2).geo_context c.fight##i.geo_context i.context i.sex c.age i.education if country==1
logit choice c.flight##ib(2).geo_context c.fight##i.geo_context i.context i.sex c.age i.education if country==1, or



*** Graphical illustration of FIGHT and FLIGHT interactions with geographic context in Ukraine (Figure 5)
logit choice c.flight##i.geo_context c.fight##i.geo_context i.context i.sex c.age i.education if country==1

margins, dydx(fight flight) at(geo_context=(1(1)2)) level(95)
marginsplot, bydimension(geo_context) recastci(rcap) ciopts(lpattern(dash)) recast(bar) yline(0) xlabel(1(1)2) ///
xtitle(Real World Context) ytitle(pred. prob. dominant face) title ("") scheme(s2color)



********************************************* SUPPLEMENTARY MATERIALS********************************************************************
****S.1: Descriptive statistics for full sample:
tab sex

summ age

tab education

tab geo_context

tab context

summ left_right

summ SDO

summ RWA

tab HD_game

summ fight

summ flight

bys country: summ identify_UkrainePoland

summ identify_Russia

summ identify_Europe


****S.5: Correlations across background variables and individual difference variables
pwcorr SDO RWA left_right HD_game fight flight sex age education, sig


****S.6: Full models for Test 2
**SDO, RWA and ideology:
logit choice c.SDO c.RWA c.left_right i.context i.sex c.age i.education i.geo_context 

**Hawk-Dove game:
logit choice i.HD_game i.context i.sex c.age i.education i.geo_context 



****S.7: Robustness analyses for ideology
** Analyses that use catergorical measures for ideology and/or includes dummy for subjects placing themselves in the middle of the ideology scale.

* Creates categorical ideology variables
*Variable with all eleven categories included
clonevar pol_id = q8

*Dummy variable for subjects placing themselves in the middle category on ideology
recode pol_id (5=1) (else=0), generate(pol_id_mid)

*Variable consisting of three categories (below mid-point, midpoint, above midpoint)
recode pol_id (0 1 2 3 4 = 0) (5=1) (6 7 8 9 10=2), generate(pol_id_3)
*Labels for three category ideology variable
label define pol_id_3LB 0 "leftwing" 1 "midpoint" 2 "rightwing" 
label values pol_id_3 pol_id_3LB


***Tests if ideology exerts an effect on leader preferences if the mid-point is accounted for (reported as Model A in Table S.7)
logit choice c.SDO c.RWA c.left_right i.pol_id_mid i.context i.sex c.age i.education i.geo_context


***Tests if three category ideology variable is significant (reported as Model B in Table S.7)
logit choice c.SDO c.RWA ib(1).pol_id_3 i.context i.sex c.age i.education i.context



****S.8: Robustness analyses for RWA
***Model employing a seven item version of the RWA variable (reported in Table S.8.1, Model A)
logit choice c.SDO c.RWA_7 c.left_right i.context i.sex c.age i.education i.geo_context 

***Models excluding different rival constructs to RWA:
* Excluding SDO (reported in Table S.8.2, Model A)
logit choice c.RWA c.left_right i.context i.sex c.age i.education i.geo_context

* Excluding all other variables except experimental conditions (reported in Table S.8.1, Model B)
logit choice c.RWA i.context



****S.10: Full Models for Test 3 (ONLY UKRAINIAN SUBJECTS)
** Main effect of geographic context within Ukraine (Conflict versus No-Conflict region) (Reported in Table S.10, Model A)
logit choice i.context i.sex c.age i.education i.geo_context if country==1

** Interactive relationships between FIGHT and FLIGHT emotions and geographic context within Ukraine (Reported in Table S.10, Model B)
logit choice c.flight##i.geo_context c.fight##i.geo_context i.context i.sex c.age i.education if country==1



****S.11: Robustness tests for effects of emotions X geographic region interactions
****TIL APPENDIKS: Robusthedstests af effekterne af geografisk region:
*Model A
logit choice i.HD_game c.SDO c.RWA c.identify_UkrainePoland c.identify_Russia c.left_right c.flight##i.geo_context c.fight##i.geo_context i.context i.sex c.age i.education if country==1
*Model B:
logit choice i.HD_game c.SDO c.RWA c.identify_UkrainePoland##i.geo_context c.identify_Russia##i.geo_context c.left_right c.flight##i.geo_context c.fight##i.geo_context i.context i.sex c.age i.education if country==1
